<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
    <title>问题反馈管理</title>
    <meta name="decorator" content="default"/>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#value").focus();
            $("#inputForm").validate({
                submitHandler: function (form) {
                    loading('正在提交，请稍等...');
                    form.submit();
                },
                errorContainer: "#messageBox",
                errorPlacement: function (error, element) {
                    $("#messageBox").text("输入有误，请先更正。");
                    if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
                        error.appendTo(element.parent().parent());
                    } else {
                        error.insertAfter(element);
                    }
                }
            });
        });
    </script>
</head>
<body>
<ul class="nav nav-tabs">
    <li><a href="${ctx}/business/feedback?category=1">家长问题反馈</a></li>
    <li class="active"><a href="${ctx}/business/feedback/form?id=${feedback.id}">家长反馈处理</a></li>
</ul>
<br/>
<form:form id="inputForm" modelAttribute="feedback" action="${ctx}/business/feedback/save" method="post"
           class="form-horizontal">
    <form:hidden path="id"/>
    <tags:message content="${message}"/>
    <div class="control-group">
        <label class="control-label">反馈标题:</label>
        <div class="controls">
            <form:input path="title" name="title" htmlEscape="false" maxlength="50" class="required" readonly="true"/>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">类型:</label>
        <div class="controls">
            <form:select path="type" name="type" class="input-medium required" disabled="true">
                <form:options items="${dic:getBusDictList('freedback_type')}" itemLabel="label"
                              itemValue="value" htmlEscape="false"/>
            </form:select>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">分类:</label>
        <div class="controls">
            <form:select path="category" name="category" class="input-medium required" disabled="true">
                <form:options items="${dic:getBusDictList('freedback_category')}" itemLabel="label"
                              itemValue="value" htmlEscape="false"/>
            </form:select>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">反馈人:</label>
        <div class="controls">
            <c:if test="${feedback.category=='0'}">
                <input value="${feedback.fromTeacher.name}" class="required" type="text" readonly="readonly">
            </c:if>
            <c:if test="${feedback.category=='1'}">
                <input value="${feedback.parent.name}" class="required" type="text" readonly="readonly">
            </c:if>

        </div>
    </div>
    <c:if test="${feedback.category=='1'}">
        <div class="control-group">
            <label class="control-label">班主任:</label>
            <div class="controls">
                <input value="${feedback.toTeacher.name}" class="required" type="text" readonly="readonly">
            </div>
        </div>
    </c:if>
    <div class="control-group">
        <label class="control-label">提交时间:</label>
        <div class="controls">
            <input value="${feedback.submitTime}" class="required" type="text" readonly="readonly">
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">反馈内容:</label>
        <div class="controls">
            <form:textarea path="content" htmlEscape="false" rows="3" maxlength="200" class="input-xlarge"
                           readonly="true"/>

        </div>
    </div>

    <%--<c:forEach  items="" var="">--%>
    <%--<div style="height:200px;width:400px;overflow-y: auto; border: 2px solid #000; margin: 20px;padding: 20px;">
    </div>--%>
    <%--</c:forEach>--%>
    <div class="control-group">
        <label class="control-label"></label>
        <div class="controls">
            <div style="height:200px;width:280px;overflow-y: auto; border: 1px solid #000;padding: 10px;">
                <c:forEach items="${list}" var="S" >
                    <p><b> ${S.replyTeacher.name}${S.parent.name}
                        <c:if test="${(empty S.replyTeacher) && (empty S.parent)}">系统回复</c:if>
                        :</b>${S.content}  </p>
                </c:forEach>
            </div>
        </div>
    </div>


    <div class="control-group">
        <label class="control-label">处理结果:</label>
        <div class="controls">
            <textarea id="result" name="result" maxlength="200" class="input-xlarge valid" rows="3" aria-invalid="false"></textarea>
        </div>
    </div>
    <input id="freedback_status" name="status" value="${feedback.status}" type="hidden">
    <div class="form-actions">
        <shiro:hasPermission name="business:feedback:edit">
            <input id="btnSubmit" class="btn btn-primary" type="button" onclick="sub('2')" value="稍后处理"/>&nbsp;
            <input id="btnSubmit" class="btn btn-primary" type="button" onclick="sub('3')" value="完成处理"/>&nbsp;
        </shiro:hasPermission>
        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
    </div>
</form:form>
<script>
    function sub(k) {
        $("#freedback_status").val(k);
        $("#inputForm").submit();
    }
</script>
</body>
</html>